package com.bawei.class_club.test

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.bawei.class_club.R
import com.bawei.lib_common.diffutil.MyAdapter
import com.bawei.lib_common.diffutil.MyModel
import com.scwang.smart.refresh.layout.SmartRefreshLayout

class RecyclerActivity : AppCompatActivity() {

    private lateinit var rv:RecyclerView

    private lateinit var srl:SmartRefreshLayout

    private lateinit var myAdapter: MyAdapter

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_recycler)

        rv = findViewById(R.id.rv)
        srl = findViewById(R.id.srl)
        myAdapter = MyAdapter()

        val list:MutableList<MyModel> = mutableListOf()

        for (i in 1..10) {
            list.add(MyModel(i, "https://picsum.photos/200/300?random=$i", "标题$i", false))
        }
        myAdapter.setData(list)
        rv.adapter = myAdapter
        rv.layoutManager = LinearLayoutManager(this)

    }
}